<?php
    include 'base.php';

    $pagenum = $_GET['pagenum'];
    $pagesize = $_GET['pagesize'];
    // $pagenum = 1;
    // $pagesize = 24;

    $start = ($pagenum - 1) * $pagesize;

    $sql = "SELECT * FROM `goods` LIMIT $start, $pagesize";

    $res = $conn->query($sql);

    $arr = Array();

    while ($row = mysqli_fetch_assoc($res)) {
        array_push($arr, $row);
    }
    $sql2 = "SELECT * FROM `goods`";

    $res2 = $conn->query($sql2);

    $n = 0;

    while ($row2 = mysqli_fetch_assoc($res2)) {
        $n++;
    }
    // echo json_encode($n)
    echo json_encode(Array(
        'total' => $n,
        'code' => 0,
        'msg' => '请求成功',
        'data' => $arr
    ));
?>